home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / cpiocopy < prev    next >
Text File  |  1995-07-22  |  637b  |  34 lines

  1. :
  2. # cpiocopy - a script to recursively copy a hierarchy using cpio
  3. # written 15 Nov 93 by Ronald Joe Record (rr@sco.com)
  4. #
  5.  
  6. usage() {
  7.     echo "Usage: cpiocopy source destination\n"
  8.     echo "\tWhere source indicates an existing directory\n"
  9.     echo "\tand destination is where you want the copied files to go.\n"
  10.     exit 1
  11. }
  12.  
  13. error() {
  14.     echo "cpiocopy: $1"
  15.     exit 2
  16. }
  17.  
  18. [ $# = 2 ] || usage
  19.  
  20. [ -d $1 ] || error "$1 non-existant or not a directory"
  21.  
  22. [ -d $2 ] || mkdir -p $2 || error "Cannot create directory $2"
  23.  
  24. HERE=`pwd`
  25. cd $2
  26. THERE=`pwd`
  27. cd $HERE
  28.  
  29. cd $1 || error "Cannot change directory to $1"
  30.  
  31. find . -depth -print | cpio -pdmu $THERE
  32.  
  33. exit 0
  34.